package cn.ht.jywrwater.module.ht.dal.mysql.customermeterdevice;

import java.util.*;

import cn.ht.jywrwater.framework.common.pojo.PageResult;
import cn.ht.jywrwater.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.ht.jywrwater.framework.mybatis.core.mapper.BaseMapperX;
import cn.ht.jywrwater.module.ht.dal.dataobject.customermeterdevice.CustomerMeterDeviceDO;
import org.apache.ibatis.annotations.Mapper;
import cn.ht.jywrwater.module.ht.controller.admin.customermeterdevice.vo.*;

/**
 * 小口径流量 Mapper
 *
 * @author hzx
 */
@Mapper
public interface CustomerMeterDeviceMapper extends BaseMapperX<CustomerMeterDeviceDO> {

    default PageResult<CustomerMeterDeviceDO> selectPage(CustomerMeterDevicePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CustomerMeterDeviceDO>()
                .eqIfPresent(CustomerMeterDeviceDO::getMeterCode, reqVO.getMeterCode())
                .eqIfPresent(CustomerMeterDeviceDO::getBelongTo, reqVO.getBelongTo())
                .eqIfPresent(CustomerMeterDeviceDO::getCustomerCode, reqVO.getCustomerCode())
                .orderByDesc(CustomerMeterDeviceDO::getId));
    }

    default List<CustomerMeterDeviceDO> selectList(CustomerMeterDeviceExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<CustomerMeterDeviceDO>()
                .eqIfPresent(CustomerMeterDeviceDO::getMeterCode, reqVO.getMeterCode())
                .eqIfPresent(CustomerMeterDeviceDO::getBelongTo, reqVO.getBelongTo())
                .eqIfPresent(CustomerMeterDeviceDO::getCustomerCode, reqVO.getCustomerCode())
                .orderByDesc(CustomerMeterDeviceDO::getId));
    }

}
